package kr.pe.johnkim.checkmileage.mobile.rest.dao;

import kr.pe.johnkim.checkmileage.mobile.domain.CheckMileageMemberMileageLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;

/**
 * Check Mileage 사용자 마일리지 로그 관련 DAO 메소드들을 구현하는 클래스 이다.
 *
 * @author : johnkim <cale9797@gmail.com / Bettersoft, Inc.>
 * @Date : 12. 7. 25
 */
public class CheckMileageMemberMileageLogDaoImpl extends SqlMapClientDaoSupport implements CheckMileageMemberMileageLogDao {

    // SLF4J Logging
	private Logger logger = LoggerFactory.getLogger(CheckMileageMemberMileageLogDaoImpl.class);

    /**
     * 사용자 마일리지 이력을 저장 한다.
     *
     * @param checkMileageMemberMileageLog
     */
    @Override
    public void registerLog(CheckMileageMemberMileageLog checkMileageMemberMileageLog) {
        logger.info("registerLog");

        getSqlMapClientTemplate().insert("CHECKMILEAGE_MEMBER_MILEAGE_LOGS.registerLog", checkMileageMemberMileageLog);
    }

    /**
     * 특정 업체에 대한 마일리지 이력을 가져 온다.
     *
     * @param checkMileageMemberMileageLog
     * @return
     */
    @Override
    public List<CheckMileageMemberMileageLog> selectMemberMileageLogList(CheckMileageMemberMileageLog checkMileageMemberMileageLog) {
        logger.info("selectMemberMileageLogList");

        return this.getSqlMapClientTemplate().queryForList("CHECKMILEAGE_MEMBER_MILEAGE_LOGS.selectMemberMileageLogList", checkMileageMemberMileageLog);
    }
}
